<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
 <%@ taglib prefix="s" uri="/struts-tags"%>

 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<div id="bottom">
  <div class="search_list">
    <div class="header_bar" style="line-height:30px; height:70px;">
      <div style="float:left; margin-top:10px; width:600px;"> 8743 Thomas Drive, Panama City Beach, Fl., 32408, US <br />
        <p style="font:normal 13px Arial, Helvetica, sans-serif; margin:0; padding:0; color:#999999;">HomeAway #285854 Preview Listing</p>
      </div>
    </div>
		 <s:include value="/frontend/template/html/user/owner/tabs.jsp"></s:include>  
<div class="edit_list_feild_sect">
    <div class="header"><strong>Vacation Rental Address</strong>
    	 <s:include value="/frontend/template/html/user/owner/save.jsp"></s:include>   
    </div>
    <div class="des">
		<div class="errorMsg">${errorMsg}</div>
    	<p>We do not display your address on our website. It is used only for address verification.</p>
        <s:if test="%{isproduct == false}">
			<s:include value="/frontend/template/html/user/product/edit/newProd.jsp" />
		</s:if>
		<s:else>
			<s:include value="/frontend/template/html/user/product/edit/productDetail.jsp"/>
		</s:else>
    </div>
    
<div id="newProd" <s:if test="%{isproduct == false}">style="display:none"</s:if>>

 <div class="header"><strong>Traveler Map </strong> </div>
      <div class="des">
        <p>The traveler map gives travelers a bird's eye view of your property location without displaying your address. Rank higher in search results by allowing map searches and displaying a property marker. Learn more...</p>
		<div class="prv_set">
			<strong>Privacy Settings</strong>
		</div>
		<div class="prev_map">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:20px;">
			  <tr>
				<td><input name="" type="checkbox" value=""> Allow travelers to zoom</td>
				<td><input name="" type="checkbox" value="" /> Display my property marker</td>
			  </tr>
			</table>
			<img src="images/prev_map.png" alt="" />
		</div>
      </div>
      <div class="header"><strong>Nearby Places and Activities </strong> </div>

<script type="text/javascript">
 function updateGenArrr()
 {
	 	var xmlhttp;
		if (window.XMLHttpRequest)
	  	{
		  	// code for IE7+, Firefox, Chrome, Opera, Safari
	  		xmlhttp=new XMLHttpRequest();
	  	}
		else
	  	{
		  	// code for IE6, IE5
	  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
		xmlhttp.onreadystatechange=function()
	  	{
	  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    	{
	  			document.getElementById("res").innerHTML=xmlhttp.responseText;
	    	}
	  	}
		var x=document.getElementById("updateGeneralAttribute");
		dataString = "" ;
		for (var i=0;i<x.length;i++)
		{
			name = x.elements[i].name ;
		    value = x.elements[i].value;
		    dataString = dataString + "&"+name+"="+value ;
		}
		productId = document.getElementById('productId').value ;
		var mycar = "" ;
		for (var i=0; i < document.updateGeneralAttribute.Car.length; i++)
		{
		   if (document.updateGeneralAttribute.Car[i].checked)
		   {
			   mycar = document.updateGeneralAttribute.Car[i].value;
		   }
		}
		req = "updateGeneralAttribute?productId="+productId + dataString +"&mycar="+mycar;
		xmlhttp.open("GET",req,true);
		xmlhttp.send();
 }
 </script>
<div id = "res"> </div>
<input type="hidden" id="productId" name="productId" value="${product.uuid}">
<form name="updateGeneralAttribute" id="updateGeneralAttribute" method="post" action="updateGeneralAttribute">
<input type="hidden" id="attributeSet" name="attributeSet" value="General">
      <div id="Npa">
      	<div class="left">
        	<ul style="margin-top:15px;">
            	<li>Car</li>
                <li class="mar10">Nearest Airport</li>
                <li class="mar10">Nearest Beach</li>
                <li class="mar6">Nearest Ferry</li>
                <li>Nearest Train</li>
                <li class="mar6">Nearest Highway</li>
                <li class="mar10">Nearest Bar</li>
                <li class="mar10">Nearest Ski</li>
                <li class="mar10">Nearest Golf</li>
                <li>Nearest Restaurant</li>
            </ul>
        </div>
        <div class="right">
			<s:set name="av" value="getAttributeValue('General' , product)"/>
        	<div class="fieldgroup">
				
            	<div class="bottom-divider">
                	<ul>
						
                    	<li><input type="radio" id="Car" name="Car" <s:if test="%{#av['Car'] == 'necessary'}">checked</s:if> value="necessary"/> necessary</li>
                        <li><input type="radio" id="Car" name="Car" <s:if test="%{#av['Car'] == 'not necessary'}">checked</s:if> value="not necessary"/>not necessary</li>
                        <li><input type="radio" id="Car" name="Car" <s:if test="%{#av['Car'] == 'recommended'}">checked</s:if> value="recommended"/>recommended</li>
                    </ul>
                </div>
                <div id="Fields">
                	<ul>
                    	<li class="first">
							
							
                        	<input type="text" name="Nearest Airport" name="Nearest Airport" value="${av['Nearest Airport']}" class="inputbox"/>
                        </li>
                        <li class="second">
                        	<input type="text" name="Nearest Airport Distance" value="${av['Nearest Airport Distance']}"  class="inputbox"/>
                        </li>
                        <li><select name="Nearest Airport Distance Unit" class="inputbox">
          					<option value="miles" <s:if test="%{#av['Nearest Airport Distance Unit'] == 'miles'}">selected</s:if>>miles</option>
							<option value="K.M." <s:if test="%{#av['Nearest Airport Distance Unit'] == 'K.M.'}">selected</s:if>>K.M.</option>
							<option value="meter" <s:if test="%{#av['Nearest Airport Distance Unit'] == 'meter'}">selected</s:if>>meter</option>
        					</select>		
                        </li>
                    </ul>
                    <ul>
                    	<li class="first">
                        	<input type="text" name="Nearest Beach" value="${av['Nearest Beach']}"  class="inputbox"/>
                        </li>
                        <li class="second">
                        	<input type="text" name="Nearest Beach Distance" value="${av['Nearest Beach Distance']}"  class="inputbox"/>
                        </li>
                        <li><select name="Nearest Beach Distance Unit" class="inputbox">
          					<option value="miles" <s:if test="%{#av['Nearest Beach Distance Unit'] == 'miles'}">selected</s:if>>miles</option>
							<option value="K.M." <s:if test="%{#av['Nearest Beach Distance Unit'] == 'K.M.'}">selected</s:if>>K.M.</option>
							<option value="meter" <s:if test="%{#av['Nearest Beach Distance Unit'] == 'meter'}">selected</s:if>>meter</option>
        					</select>		
                        </li>
                    </ul>
                    <ul>
                    	<li class="first">
                        	<input type="text" name="Nearest Ferry" value="${av['Nearest Ferry']}"  class="inputbox"/>
                        </li>
                        <li class="second">
                        	<input type="text" name="Nearest Ferry Distance" value="${av['Nearest Ferry Distance']}"  class="inputbox"/>
                        </li>
                        <li><select name="Nearest Ferry Distance Unit" class="inputbox">
          					<option value="miles" <s:if test="%{#av['Nearest Ferry Distance Unit'] == 'miles'}">selected</s:if>>miles</option>
							<option value="K.M." <s:if test="%{#av['Nearest Ferry Distance Unit'] == 'K.M.'}">selected</s:if>>K.M.</option>
							<option value="meter" <s:if test="%{#av['Nearest Ferry Distance Unit'] == 'meter'}">selected</s:if>>meter</option>
        					</select>		
                        </li>
                    </ul>
                    <ul>
                    	<li class="first">
                        	<input type="text" name="Nearest Train" value="${av['Nearest Train']}"  class="inputbox"/>
                        </li>
                        <li class="second">
                        	<input type="text" name="Nearest Train Distance" value="${av['Nearest Train Distance']}"  class="inputbox"/>
                        </li>
                        <li><select name="Nearest Train Distance Unit" class="inputbox">
          					<option value="miles" <s:if test="%{#av['Nearest Train Distance Unit'] == 'miles'}">selected</s:if>>miles</option>
							<option value="K.M." <s:if test="%{#av['Nearest Train Distance Unit'] == 'K.M.'}">selected</s:if>>K.M.</option>
							<option value="meter" <s:if test="%{#av['Nearest Train Distance Unit'] == 'meter'}">selected</s:if>>meter</option>
        					</select>		
                        </li>
                    </ul>
                    <ul>
                    	<li class="first">
                        	<input type="text" name="Nearest Highway" value="${av['Nearest Highway']}" class="inputbox"/>
                        </li>
                        <li class="second">
                        	<input type="text" name="Nearest Highway Distance" value="${av['Nearest Highway Distance']}"  class="inputbox"/>
                        </li>
                        <li><select name="Nearest Highway Distance Unit" class="inputbox">
          					<option value="miles" <s:if test="%{#av['Nearest Highway Distance Unit'] == 'miles'}">selected</s:if>>miles</option>
							<option value="K.M." <s:if test="%{#av['Nearest Highway Distance Unit'] == 'K.M.'}">selected</s:if>>K.M.</option>
							<option value="meter" <s:if test="%{#av['Nearest Highway Distance Unit'] == 'meter'}">selected</s:if>>meter</option>
        					</select>		
                        </li>
                    </ul>
                    <ul>
                    	<li class="first">
                        	<input type="text" name="Nearest Bar" value="${av['Nearest Bar']}"  class="inputbox"/>
                        </li>
                        <li class="second">
                        	<input type="text" name="Nearest Bar Distance" value="${av['Nearest Bar Distance']}"  class="inputbox"/>
                        </li>
                        <li><select name="Nearest Bar Distance Unit" class="inputbox">
          					<option value="miles" <s:if test="%{#av['Nearest Bar Distance Unit'] == 'miles'}">selected</s:if>>miles</option>
							<option value="K.M." <s:if test="%{#av['Nearest Bar Distance Unit'] == 'K.M.'}">selected</s:if>>K.M.</option>
							<option value="meter" <s:if test="%{#av['Nearest Bar Distance Unit'] == 'meter'}">selected</s:if>>meter</option>
        					</select>		
                        </li>
                    </ul>
                    <ul>
                    	<li class="first">
                        	<input type="text" name="Nearest Ski" value="${av['Nearest Ski']}"  class="inputbox"/>
                        </li>
                        <li class="second">
                        	<input type="text" name="Nearest Ski Distance" value="${av['Nearest Ski Distance']}"  class="inputbox"/>
                        </li>
                        <li><select name="Nearest Ski Distance Unit" class="inputbox">
          					<option value="miles" <s:if test="%{#av['Nearest Ski Distance Unit'] == 'miles'}">selected</s:if>>miles</option>
							<option value="K.M." <s:if test="%{#av['Nearest Ski Distance Unit'] == 'K.M.'}">selected</s:if>>K.M.</option>
							<option value="meter" <s:if test="%{#av['Nearest Ski Distance Unit'] == 'meter'}">selected</s:if>>meter</option>
        					</select>		
                        </li>
                    </ul>
                    <ul>
                    	<li class="first">
                        	<input type="text" name="Nearest Golf" value="${av['Nearest Golf']}"  class="inputbox"/>
                        </li>
                        <li class="second">
                        	<input type="text" name="Nearest Golf Distance" value="${av['Nearest Golf Distance']}"  class="inputbox"/>
                        </li>
                        <li><select name="Nearest Golf Distance Unit" class="inputbox">
          					<option value="miles" <s:if test="%{#av['Nearest Golf Distance Unit'] == 'miles'}">selected</s:if>>miles</option>
							<option value="K.M." <s:if test="%{#av['Nearest Golf Distance Unit'] == 'K.M.'}">selected</s:if>>K.M.</option>
							<option value="meter" <s:if test="%{#av['Nearest Golf Distance Unit'] == 'meter'}">selected</s:if>>meter</option>
        					</select>		
                        </li>
                    </ul>
                    <ul>
                    	<li class="first">
                        	<input type="text" name="Nearest Restaurant" value="${av['Nearest Restaurant']}"  class="inputbox"/>
                        </li>
                        <li class="second">
                        	<input type="text" name="Nearest Restaurant Distance" value="${av['Nearest Restaurant Distance']}"  class="inputbox"/>
                        </li>
                        <li><select name="Nearest Restaurant Distance Unit" class="inputbox">
          					<option value="miles" <s:if test="%{#av['Nearest Restaurant Distance Unit'] == 'miles'}">selected</s:if>>miles</option>
							<option value="K.M." <s:if test="%{#av['Nearest Restaurant Distance Unit'] == 'K.M.'}">selected</s:if>>K.M.</option>
							<option value="meter" <s:if test="%{#av['Nearest Restaurant Distance Unit'] == 'meter'}">selected</s:if>>meter</option>
        					</select>		
                        </li>
                    </ul>
                </div>
            </div>
        </div>
						<input type="button" name="save" value="Save" onclick="updateGenArrr();">
      </div>

</form>


       <div class="header"><strong>Setting & View </strong> </div>
       <div id="Npa">
<s:set name="pt" value="getProductType(product)"/>

<script type="text/javascript">
 function updatePT()
 {
	 	var xmlhttp;
		if (window.XMLHttpRequest)
	  	{
		  	// code for IE7+, Firefox, Chrome, Opera, Safari
	  		xmlhttp=new XMLHttpRequest();
	  	}
		else
	  	{
		  	// code for IE6, IE5
	  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
		xmlhttp.onreadystatechange=function()
	  	{
	  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    	{
	  			document.getElementById("pts").innerHTML=xmlhttp.responseText;
	    	}
	  	}
		var x=document.getElementById("updateProductType");
		dataString = "" ;
		for (var i=0;i<x.length;i++)
		{
			name = x.elements[i].name ;
		    value = x.elements[i].checked;
		    dataString = dataString + "&"+name+"="+value ;
		}
		productId = document.getElementById('productId').value ;
		req = "updateProductType?productId="+productId + dataString ;
		xmlhttp.open("GET",req,true);
		xmlhttp.send();
 }
 </script>
<div id="pts"></div>
<form name="updateProductType" id="updateProductType" action="updateProductType" method="post">
       		<div class="left bold">
            	Location Type
            </div>
            <div class="right">
            	<div class="fieldgroup">
                <div class="chkbox">
					<s:set name="counter" value="0"/>
					
					<s:iterator value="pt" var="pt">
						<s:set name="tmpcount" value ="%{#counter%3}"/>
						<s:if test="%{#tmpcount == 0}">
					  			<ul>
						</s:if>
							<li><input type="checkbox" name="producttype_${key.uuid}" <s:if test="%{value == true}">checked</s:if>/> ${key.productType}</li>
							<s:set name="counter" value ="%{#counter + 1}"/>
							<s:set name="tmpcount" value ="%{#counter%3}"/>
								<s:if test="%{#tmpcount == 0}">
					  				</ul>
								</s:if>
					</s:iterator>
                </div>
                </div>
			<input type="button" name="save" value="Save" onclick="updatePT();">
            </div>
</form>
</div>
<script type="text/javascript">
 function updateAttractionsAttr()
 {
	 	var xmlhttp;
		if (window.XMLHttpRequest)
	  	{
		  	// code for IE7+, Firefox, Chrome, Opera, Safari
	  		xmlhttp=new XMLHttpRequest();
	  	}
		else
	  	{
		  	// code for IE6, IE5
	  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
		xmlhttp.onreadystatechange=function()
	  	{
	  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    	{
	  			document.getElementById("attractionUpdate").innerHTML=xmlhttp.responseText;
	    	}
	  	}
		var x=document.getElementById("updateAttractions");
		dataString = "" ;
		for (var i=0;i<x.length;i++)
		{
			name = x.elements[i].name ;
		    value = x.elements[i].checked;
		    dataString = dataString + "&"+name+"="+value ;
		}
		productId = document.getElementById('productId').value ;
		attributeSetName = document.getElementById('attributeSetName').value ;
		req = "updateAttractions?productId="+productId + dataString +"&attributeSetName="+attributeSetName ;
		xmlhttp.open("POST",req,true);
		xmlhttp.send();
 }
 </script>
<input type="hidden" name="attributeSetName" id="attributeSetName" value="Attractions">


<form name="updateAttractions" id="updateAttractions" action="updateAttractions" method="post">
<div class="header"><strong>Local Attractions & Activities </strong> </div>
<div id="attractionUpdate"></div>
<p class="des">Please check any local attractions and activities available within 15 minutes from your rental.</p>


<s:set name="pav" value="getProductAvByAttributeSet('Attractions',product)"/>
	<s:iterator value="pav" var="pav">
		<s:set name="counter" value="0"/>
		 <div id="Npa">
       		<div class="left bold">
            	${attribute.name}
            </div>
			<div class="right">
            	<div class="fieldgroup">
                	<div class="chkbox">
						<s:if test="attribute.multivalued == true">
							<s:set name="valItr" value="attribute.values"/>
							<s:iterator value="valItr" var="av">
								<s:if test="%{#av.attributeType == 'checkbox'}">
									<s:set name="checked" value="ifChecked(#pav.attributeValues,#av)"/>
            						<ul>
										<li><input type="checkbox" name="chk_${uuid}" value="${stringValue}" <s:if test="%{#checked == true}">checked</s:if>> ${label}</li> 
									</ul>
								</s:if>
							</s:iterator>
						</s:if>
					</div>
				</div>
			</div>
		</div>
	</s:iterator>
	<input type="button" name="Save" value="Save" onclick="updateAttractionsAttr();">
</form>

<script type="text/javascript">
 function updateProdData()
 {
	 	var xmlhttp;
		if (window.XMLHttpRequest)
	  	{
		  	// code for IE7+, Firefox, Chrome, Opera, Safari
	  		xmlhttp=new XMLHttpRequest();
	  	}
		else
	  	{
		  	// code for IE6, IE5
	  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
		xmlhttp.onreadystatechange=function()
	  	{
	  		if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    	{
	  			document.getElementById("prodData").innerHTML=xmlhttp.responseText;
	    	}
	  	}
		var x=document.getElementById("updateProductData");
		dataString = "" ;
		for (var i=0;i<x.length;i++)
		{
			name = x.elements[i].name ;
		    value = x.elements[i].value;
		    dataString = dataString + "&"+name+"="+value ;
		}
		productId = document.getElementById('productId').value ;
		req = "updateProductData?productId="+productId + dataString ;
		xmlhttp.open("POST",req,true);
		xmlhttp.send();
 }
 </script>
       <div class="header"><strong>Additional Descriptions</strong> </div>

<form name="updateProductData" id="updateProductData" action="updateProductData" method="post">
       <div id="Npa">
<div id="prodData"></div>
       		<div class="left" style=" margin-top:20px;">
            <div class="last bold">
            	<ul>
                	<li>Location Description</li>
                    <li>Other Activities</li>
                    <li>Ski in the Area</li>
                    <li>Golf in the Area</li>
                </ul>
            </div>
            </div>
            <div class="right">
            	<div class="txtareabox">
					<input type="hidden" name="productId" value="${product.uuid}">
                    <textarea name="locationDescription" class="textarea inputbox">${product.productData.locationDescription}</textarea>
                    <textarea name="otherActivities" class="textarea inputbox">${product.productData.otherActivities}</textarea>
                    <textarea name="skiInTheArea" class="textarea inputbox">${product.productData.skiInTheArea}</textarea>
					<textarea name="golfInTheArea" class="textarea inputbox">${product.productData.golfInTheArea}</textarea>
                </div>
                
            </div>
<input type="button" name="saveProdData" value="Save" onclick="updateProdData();"/>
            <div class="clear"></div>
            <div class="btnpanel">
    	<s:include value="/frontend/template/html/user/owner/save.jsp"></s:include>
    </div>
       </div>
		
</form>

</div>
    </div>
    
  </div>
</div>
